package org.wq.service.impl;

import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.wq.mapper.TbUserMapper;
import org.wq.po.TbUser;
import org.wq.service.UserService;

import java.util.List;

/**
 * Created by admin on 2016/11/28.
 */
@Service
@Transactional(rollbackFor = Throwable.class)
public class UserServiceImpl implements UserService {


    @Autowired
    private TbUserMapper userMapper;

    @Override
    @Transactional(readOnly = true)
    public List<TbUser> findAll() {
        return userMapper.selectAll();
    }

    @Override
    public List<TbUser> getUserPage(int page, int rows) {
        // 设置分页
        PageHelper.startPage(page, rows);
        // 查询出所有数据
        List<TbUser> userList = userMapper.selectAll();

        return userList;
    }


}
